import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { resolve } from 'path'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'


const serverUrl = 'http://admin.zcsgbznt.com/city/'
// const serverUrl = 'http://192.168.4.196:8080/jeecg-boot/'
const api = ['/noLoginApi']
let proxyArr = {}
api.forEach(item => {
	proxyArr[item] = serverUrl
})

// https://vitejs.dev/config/
export default defineConfig({
	publicPath: './',
	base: './',
    plugins: [
		vue({reactivityTransform: true }),
		AutoImport({
			resolvers: [ElementPlusResolver()],
		}),
		Components({
			resolvers: [ElementPlusResolver()],
		}),
	],
    resolve: {
		host: '0.0.0.0',
		alias: {
		  '@': resolve(__dirname, 'src') // 设置 `@` 指向 `src` 目录
		}
	},
	server: {
		proxy: proxyArr
	},
})
